package by.sjc.grsu.web.controller;

import by.sjc.grsu.model.Payment;
import by.sjc.grsu.model.Periodical;
import by.sjc.grsu.model.Subscription;
import by.sjc.grsu.service.PaymentService;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpSession;

@Controller
public class AdminController {
    public static final Logger logger = Logger.getLogger(AdminController.class);

    @Autowired
    private PaymentService paymentService;

    @PreAuthorize("isFullyAuthenticated()")
    @RequestMapping(value = "/payment/list", method = RequestMethod.GET)
    public ModelAndView payment() {
        ModelAndView mav = new ModelAndView("/payment/list");
        mav.addObject("payments", paymentService.getAll());
        return mav;
    }
}
